<template>
  <div>
    <div>
      <ele-page
        v-loading="loading"
        :formConfig="searchConfig"
        ref="eleTable"
        :operateList="operateList"
        @handleOperateEvent="handleOperateEvent"
        :column="column"
        :getList="getList"
        uniqueId="mesProdBoxcodeClearLogTable"
      >
      </ele-page>
    </div>
  </div>
</template>

<script>
import { operateList, searchConfig } from './config'
import { getList } from '@/api/print/mesProdOthercodeClearLog'
import { getDict } from '@/api/common'

export default {
  name: 'mesProdOthercodeClearLog',
  components: { },
  data () {
    return {
      title: null,
      visible: false,
      isLoading: false,
      loading: false,
      formDataDialog: {},
      searchConfig,
      operateList,
      getList,
      // 列表页字段的绑定配置
      column: [
        {
          type: 'selection',
          fixed: 'left'
        },
        {
          type: 'index',
          label: $i18n.t('common.order'),
          width: 60,
          fixed: 'left'
        },
        {
          prop: 'barcode',
          label: $i18n.t('mesOtherCodeClearingRecord.uniqueCode'),
          minWidth: 350,
          showOverflowTooltip: true,
          fixed: 'left'
        },
        {
          prop: 'codeType',
          label: $i18n.t('mesOtherCodeClearingRecord.codeType'),
          minWidth: 150,
          showOverflowTooltip: true,
          fixed: 'left',
          optionProp: {
            value: 'value',
            label: 'description'
          },
          option: async (data) => {
            const list = await getDict('mes_code_type')
            return list.data.result
          }
        },
        {
          prop: 'planCode',
          label: $i18n.t('mesOtherCodeClearingRecord.planCode'),
          minWidth: 180,
          showOverflowTooltip: true
        },
        {
          prop: 'orderCode',
          label: $i18n.t('mesOtherCodeClearingRecord.orderCode'),
          minWidth: 240,
          showOverflowTooltip: true
        },
        {
          prop: 'prodCode',
          label: $i18n.t('mesOtherCodeClearingRecord.prodCode'),
          minWidth: 150,
          showOverflowTooltip: true
        },
        {
          prop: 'prodName',
          label: $i18n.t('mesOtherCodeClearingRecord.prodName'),
          minWidth: 200,
          showOverflowTooltip: true
        },
        {
          prop: 'clearByName',
          label: $i18n.t('mesOtherCodeClearingRecord.clearByName'),
          minWidth: 180,
          showOverflowTooltip: true
        },
        {
          prop: 'clearTime',
          label: $i18n.t('mesOtherCodeClearingRecord.clearTime'),
          minWidth: 180,
          showOverflowTooltip: true
        },
        {
          prop: 'clearReason',
          label: $i18n.t('mesOtherCodeClearingRecord.clearReason'),
          minWidth: 280,
          showOverflowTooltip: true
        },
        {
          prop: 'seriesCode',
          label: $i18n.t('mesOtherCodeClearingRecord.seriesCode'),
          minWidth: 150,
          showOverflowTooltip: true
        },
        {
          prop: 'seriesName',
          label: $i18n.t('mesOtherCodeClearingRecord.seriesName'),
          minWidth: 200,
          showOverflowTooltip: true
        },
        {
          prop: 'planBeginDate',
          label: $i18n.t('mesOtherCodeClearingRecord.planBeginDate'),
          minWidth: 150,
          showOverflowTooltip: true
        },
        {
          prop: 'planEndDate',
          label: $i18n.t('mesOtherCodeClearingRecord.planEndDate'),
          minWidth: 150,
          showOverflowTooltip: true
        },
        {
          prop: 'barcodePrintTemp',
          label: $i18n.t('mesOtherCodeClearingRecord.barcodePrintTemp'),
          minWidth: 170,
          showOverflowTooltip: true
        },
        {
          prop: 'lineCode',
          label: $i18n.t('common.lineCode'),
          minWidth: 150,
          showOverflowTooltip: true
        },
        {
          prop: 'lineName',
          label: $i18n.t('common.lineName'),
          minWidth: 150,
          showOverflowTooltip: true
        },

        {
          prop: 'isPrint',
          label: $i18n.t('mesOtherCodeClearingRecord.isPrint'),
          minWidth: 100,
          showOverflowTooltip: true,
          optionProp: {
            value: 'value',
            label: 'description'
          },
          option: async (data) => {
            const list = await getDict('yes_or_not')
            return list.data.result
          }
        },
        {
          prop: 'createByName',
          label: $i18n.t('common.createByName'),
          minWidth: 120,
          showOverflowTooltip: true
        },
        {
          prop: 'createTime',
          label: $i18n.t('common.createTime'),
          minWidth: 160,
          showOverflowTooltip: true
        },
        {
          prop: 'updateByName',
          label: $i18n.t('common.updateByName'),
          minWidth: 130,
          showOverflowTooltip: true
        },
        {
          prop: 'updateTime',
          label: $i18n.t('common.updateTime'),
          minWidth: 160,
          showOverflowTooltip: true
        }
      ]
    }
  },
  computed: {},
  methods: {
    // 表格顶部按钮操作事件
    handleOperateEvent (data) {
      this.title = data.name
      const fnc = { }
      fnc[data.handleName]()
    },
    // 表格行操作事件
    rowOperate ({ handleName, name, row }) {
      this.title = name
      const fnc = { }
      fnc[handleName]()
    },
    // 刷新表格数据
    refresh (isReset = true) {
      this.$refs.eleTable.refresh(isReset)
    }
  }
}
</script>
